package com.elite.groovy.callback

import com.elite.groovy.util.EliteBean
import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory

import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import java.text.SimpleDateFormat
/*
 * 业务库每天一点定时任务执行
 * 1.自动生成名单拨打报表；2.定时清除网销网电存储过程日志信息表；3.续保客户信息提取 4.同步机构、用户、渠道信息
 */

public class JobOneNightTask implements ServiceBackInvoke{
	private static final Log log =LogFactory.getLog(JobOneNightTask.class);
	public String doCallBack(EliteBean eliteBean, HttpServletRequest request, HttpServletResponse response) {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String useTimeInfo = "";
		Long useStartTime = System.currentTimeMillis();
		
		log.debug("业务库每天一点定时任务执行开始:" + df.format(new Date()));
		def param=new String[0];
		def procedure="{call Job_OneNightTask(?)}";
		def result=eliteBean.executeWithReturn(procedure,param,"dataSource");
		
		Long useEndTime = System.currentTimeMillis();
		useTimeInfo = Long.toString(useEndTime - useStartTime);
		
		log.debug(" 处理时长(毫秒):" + useTimeInfo + " EndTime:" + df.format(new Date()));
	}
}